﻿// -----------------------------------------------------------------------------
// Generate By Furion Tools v3.0.6                            
// -----------------------------------------------------------------------------

using Furion.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Linq;
using HOPU.OnlineSchool.Core;

namespace HOPU.OnlineSchool.Core
{
    public partial class EduCourse : IEntity<MasterDbContextLocator>, IEntityTypeBuilder<EduCourse, MasterDbContextLocator>
    {
    
        public string Id { get; set; }
        public string TeacherId { get; set; }
        public string SubjectId { get; set; }
        public string SubjectParentId { get; set; }
        public string Title { get; set; }
        public int LessonNum { get; set; }
        public string Cover { get; set; }
        public long BuyCount { get; set; }
        public long ViewCount { get; set; }
        public long Version { get; set; }
        public string Status { get; set; }
        public byte? IsDeleted { get; set; }
        public DateTime GmtCreate { get; set; }
        public DateTime GmtModified { get; set; }
    
        public void Configure(EntityTypeBuilder<EduCourse> entityBuilder, DbContext dbContext, Type dbContextLocator)
        {
                entityBuilder.ToTable("edu_course");

                entityBuilder.HasComment("课程");

                entityBuilder.HasIndex(e => e.SubjectId, "idx_subject_id");

                entityBuilder.HasIndex(e => e.TeacherId, "idx_teacher_id");

                entityBuilder.HasIndex(e => e.Title, "idx_title");

                entityBuilder.Property(e => e.Id)
                    .HasMaxLength(19)
                    .HasColumnName("id")
                    .IsFixedLength(true)
                    .HasComment("课程ID");

                entityBuilder.Property(e => e.BuyCount)
                    .HasColumnType("bigint unsigned")
                    .HasColumnName("buy_count")
                    .HasComment("销售数量");

                entityBuilder.Property(e => e.Cover)
                    .IsRequired()
                    .HasMaxLength(255)
                    .HasColumnName("cover")
                    .HasComment("课程封面图片路径");

                entityBuilder.Property(e => e.GmtCreate)
                    .HasColumnName("gmt_create")
                    .HasComment("创建时间");

                entityBuilder.Property(e => e.GmtModified)
                    .HasColumnName("gmt_modified")
                    .HasComment("更新时间");

                entityBuilder.Property(e => e.IsDeleted)
                    .HasColumnType("tinyint")
                    .HasColumnName("is_deleted")
                    .HasComment("逻辑删除 1（true）已删除， 0（false）未删除");

                entityBuilder.Property(e => e.LessonNum)
                    .HasColumnType("int unsigned")
                    .HasColumnName("lesson_num")
                    .HasComment("总课时");

                entityBuilder.Property(e => e.Status)
                    .IsRequired()
                    .HasMaxLength(10)
                    .HasColumnName("status")
                    .HasDefaultValueSql("'Draft'")
                    .HasComment("课程状态 Draft未发布  Normal已发布");

                entityBuilder.Property(e => e.SubjectId)
                    .IsRequired()
                    .HasMaxLength(19)
                    .HasColumnName("subject_id")
                    .IsFixedLength(true)
                    .HasComment("课程专业ID");

                entityBuilder.Property(e => e.SubjectParentId)
                    .IsRequired()
                    .HasMaxLength(19)
                    .HasColumnName("subject_parent_id")
                    .HasDefaultValueSql("''")
                    .IsFixedLength(true)
                    .HasComment("课程专业父级ID");

                entityBuilder.Property(e => e.TeacherId)
                    .IsRequired()
                    .HasMaxLength(19)
                    .HasColumnName("teacher_id")
                    .IsFixedLength(true)
                    .HasComment("课程讲师ID");

                entityBuilder.Property(e => e.Title)
                    .IsRequired()
                    .HasMaxLength(50)
                    .HasColumnName("title")
                    .HasComment("课程标题");

                entityBuilder.Property(e => e.Version)
                    .HasColumnType("bigint unsigned")
                    .HasColumnName("version")
                    .HasDefaultValueSql("'1'")
                    .HasComment("乐观锁");

                entityBuilder.Property(e => e.ViewCount)
                    .HasColumnType("bigint unsigned")
                    .HasColumnName("view_count")
                    .HasComment("浏览数量");
        }

    }
}
